package schedule_init

import (
	"github.com/robfig/cron/v3"
	"go_server/zinx/zlog"
)

type scheduleManager struct {
	cronObj *cron.Cron
}

var scheduleObj *scheduleManager

func StartGameSchedule() {
	scheduleObj = &scheduleManager{
		cronObj: cron.New(cron.WithSeconds()),
	}

	scheduleObj.cronObj.AddFunc("@every 1s", perSecondTimer)

	scheduleObj.cronObj.AddFunc("@daily", everyDayTimer)

	scheduleObj.cronObj.Start()
}

func StopGameSchedule() {
	scheduleObj.cronObj.Stop()
}

func perSecondTimer() {
	//everySecondEvent := event_impl.NewEverySecondEvent(event_data.EverySecondEvent, time.Now().UnixMilli())
	//event_manager.EventManagerObj.FireEventData(everySecondEvent)
}

func everyDayTimer() {
	zlog.Info("每天0点执行一次！！！！")
}